<%@page import="beans.MemberBean, entity.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/two_columns.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>更新個人資料</title>
<!-- InstanceEndEditable -->
<link href="css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" />
<!-- InstanceBeginEditable name="head" -->
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationCheckbox.js" type="text/javascript"></script>
<script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationPassword.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationConfirm.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationPassword.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationConfirm.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationCheckbox.css" rel="stylesheet" type="text/css" />
<script type="text/javascript"> 
function refresh(){
var cap = document.getElementById("cimageframe");
cap.innerHTML = "<img src='cimage?a=" + Math.random() + "'/>";
} 
</script>
<%!
    private String compare(String s1, String s2) {
        if (s1.equals(s2)) {
            return "selected='selected'";
        } else {
            return "";
        }
    }
%>
<%
            String msg = request.getParameter("msg");
            /*
           Integer personID = (Integer) session.getAttribute("personID");
            if (personID == null) {
                response.sendRedirect("login.jsp?msg=nologin");
                return;
            }
            Person member = PersonService.getById(personID.intValue());
            if (member == null) {
                response.sendRedirect("login.jsp?msg=nologin");
                return;
            }*/

            Person member = util.LoginManager.getCurrentLoginPerson(session);
            if (member == null) {
                response.sendRedirect("login.jsp?msg=nologin");
                return;
            }
            String username = member.getLoginname();
            String firstname = member.getFirstname();
            String lastname = member.getLastname();
            String birth_year = member.getBirthYear().toString();
			String birth_month = member.getBirthMonth().toString();
            String gender = member.getGender();
            String address = member.getAddress();
            String email = member.getEmail();
%>
<style type="text/css">
.CollapsiblePanel {
	width: 480px;
}
</style>
<!-- InstanceEndEditable -->

</head>
<body>
<div class="main">
  <div class="header">
    <div class="header-top">
    
      <div class="login-bg">
      <a href="login.jsp" class="black-link">登入</a><span class="style3"> |</span>
      <a href="#" class="black-link">買賣須知</a><span class="style3"> |</span>
      <a href="#" class="black-link">聯絡我們</a> <span class="style3">|</span>
      <a href="#" class="black-link">關於2HE</a>
      
      </div>
    </div>
    <div class="header-bottom"><!-- InstanceBeginEditable name="NavBar" -->
      <div id="navcontainer">
        <ul class="navlist">
          <li class=""><a href="index.jsp">首頁</a></li>
          <li class=""><a href="#">要買</a></li>
          <li class=""><a href="AddItem.jsp?go=additem">要賣</a></li>
          <li class=""><a href="changeInfo.jsp">我的主頁</a></li>
          <li class=""><a href="#">我的信箱</a></li>
        </ul>
      </div>
      <!-- InstanceEndEditable --></div>
  </div>
  <div class="body-main">
    <div class="body-leftbar-2column">
      
      <!-- InstanceBeginEditable name="leftcolumn" -->
      <div class="left-boxbar-2column-outer">
        <div class="left-boxbar-2column">
          <div class="title-back">
            <div class="changeInfo-box">              
              <div id="msg" class="error-style" align="center">
                <%if ("1".equals(msg)) {%>
                <img src="images/error/error_captcha.jpg" width="400" height="50" />
                <%}else if("3".equals(msg)) { %>
                <img src="images/error/error_change_info.jpg" width="400" height="50" />
                <%}%>
              </div>
              <fieldset>
                <legend class="gray-color">1. 基本資料<span class="red-star">*</span></legend>
                <table width="500" cellpadding="5" class="table-font-12">
                  <tr>
                    <td width="112">用戶名稱:</td>
                    <td width="365"><%=username%></td>
                  </tr>
                  <tr>
                    <td>名:</td>
                    <td><%=firstname%></td>
                  </tr>
                  <tr>
                    <td>姓:</td>
                    <td><%=lastname%></td>
                  </tr>
                  <tr>
                    <td>性別:</td>
                    <td><% if ("M".equals(gender) ) {%>
                      男
                      <% }else if ("F".equals(gender)){%>
                      女
                      <%}%></td>
                  </tr>
                </table>
              </fieldset>
              <br/>
              <fieldset>
                <legend class="gray-color">2. 更改密碼</legend>
                <table class="table-font-12">
                  <tr>
                    <td width="492"><div class="CollapsiblePanel" id="schangepasswordpanel">
                        <div class="CollapsiblePanelTab" tabindex="0">按此更改密碼</div>
                        <div class="CollapsiblePanel">
                          <form name="register" action="ChangePasswordServlet" method="post">
                            <div class="pd">
                              <div class="pdrow"><span class="pdlabel">舊密碼:<span class="red-star">*</span></span><span class="pdfield"><span id="spassword1">
                                <input name="password1" type="password" id="password1" size="20" maxlength="10" />
                                <span class="passwordRequiredMsg">必須填寫.</span><span class="passwordMinCharsMsg">最少六個英文字母或數字.</span></span></span></div>
                              <div class="pdrow"><span class="pdlabel">新密碼:<span class="red-star">*</span></span><span class="pdfield"><span id="spassword">
                                <input name="password9" type="password" id="password9" size="20" maxlength="10" />
                                <span class="passwordRequiredMsg">必須填寫.</span><span class="passwordMinCharsMsg">最少六個英文字母或數字.</span><span class="passwordInvalidStrengthMsg">密碼強度不足.</span></span><br/>
                                (六位至十位密碼) </span></div>
                              <div class="pdrow"><span class="pdlabel">新密碼確認:<span class="red-star">*</span></span><span class="pdfield"><span id="srepassword">
                                <input name="repassword" type="password" id="repassword" size="20" maxlength="10" />
                                <span class="confirmInvalidMsg">請輸入與上相同密碼</span><span class="confirmRequiredMsg">必須填寫.</span></span><br/>
                                (請重新輸入密碼作確認) </span></div>
                              <div class="pdrow" align="center">
                                <input type='image' src='images/update-bt.gif'/>
                              </div>
                            </div>
                          </form>
                        </div>
                      </div></td>
                  </tr>
                </table>
              </fieldset>
              <br/>
              <form name="register" action="ChangeInfoServlet" method="post">
                <fieldset>
                  <legend class="gray-color">3. 聯絡資料</legend>
                  <table width="500" cellpadding="5" class="table-font-12">
                    <tr>
                      <td width="102">出生年份及月份:</td>
                      <td width="370"><select name="birth_year" id="birth_year">
                          <option value="-99999">請選擇</option>
                          <option value="2007" <%=compare("2007",birth_year)%>>2007</option>
                          <option value="2006" <%=compare("2006",birth_year)%>>2006</option>
                          <option value="2005" <%=compare("2005",birth_year)%>>2005</option>
                          <option value="2004" <%=compare("2004",birth_year)%>>2004</option>
                          <option value="2003" <%=compare("2003",birth_year)%>>2003</option>
                          <option value="2002" <%=compare("2002",birth_year)%>>2002</option>
                          <option value="2001" <%=compare("2001",birth_year)%>>2001</option>
                          <option value="2000" <%=compare("2000",birth_year)%>>2000</option>
                          <option value="1999" <%=compare("1999",birth_year)%>>1999</option>
                          <option value="1998" <%=compare("1998",birth_year)%>>1998</option>
                          <option value="1997" <%=compare("1997",birth_year)%>>1997</option>
                          <option value="1996" <%=compare("1996",birth_year)%>>1996</option>
                          <option value="1995" <%=compare("1995",birth_year)%>>1995</option>
                          <option value="1994" <%=compare("1994",birth_year)%>>1994</option>
                          <option value="1993" <%=compare("1993",birth_year)%>>1993</option>
                          <option value="1992" <%=compare("1992",birth_year)%>>1992</option>
                          <option value="1991" <%=compare("1991",birth_year)%>>1991</option>
                          <option value="1990" <%=compare("1990",birth_year)%>>1990</option>
                          <option value="1989" <%=compare("1989",birth_year)%>>1989</option>
                          <option value="1988" <%=compare("1988",birth_year)%>>1988</option>
                          <option value="1987" <%=compare("1987",birth_year)%>>1987</option>
                          <option value="1986" <%=compare("1986",birth_year)%>>1986</option>
                          <option value="1985" <%=compare("1985",birth_year)%>>1985</option>
                          <option value="1984" <%=compare("1984",birth_year)%>>1984</option>
                          <option value="1983" <%=compare("1983",birth_year)%>>1983</option>
                          <option value="1982" <%=compare("1982",birth_year)%>>1982</option>
                          <option value="1981" <%=compare("1981",birth_year)%>>1981</option>
                          <option value="1980" <%=compare("1980",birth_year)%>>1980</option>
                          <option value="1979" <%=compare("1979",birth_year)%>>1979</option>
                          <option value="1978" <%=compare("1978",birth_year)%>>1978</option>
                          <option value="1977" <%=compare("1977",birth_year)%>>1977</option>
                          <option value="1976" <%=compare("1976",birth_year)%>>1976</option>
                          <option value="1975" <%=compare("1975",birth_year)%>>1975</option>
                          <option value="1974" <%=compare("1974",birth_year)%>>1974</option>
                          <option value="1973" <%=compare("1973",birth_year)%>>1973</option>
                          <option value="1972" <%=compare("1972",birth_year)%>>1972</option>
                          <option value="1971" <%=compare("1971",birth_year)%>>1971</option>
                          <option value="1970" <%=compare("1970",birth_year)%>>1970</option>
                          <option value="1969" <%=compare("1969",birth_year)%>>1969</option>
                          <option value="1968" <%=compare("1968",birth_year)%>>1968</option>
                          <option value="1967" <%=compare("1967",birth_year)%>>1967</option>
                          <option value="1966" <%=compare("1966",birth_year)%>>1966</option>
                          <option value="1965" <%=compare("1965",birth_year)%>>1965</option>
                          <option value="1964" <%=compare("1964",birth_year)%>>1964</option>
                          <option value="1963" <%=compare("1963",birth_year)%>>1963</option>
                          <option value="1962" <%=compare("1962",birth_year)%>>1962</option>
                          <option value="1961" <%=compare("1961",birth_year)%>>1961</option>
                          <option value="1960" <%=compare("1960",birth_year)%>>1960</option>
                          <option value="1959" <%=compare("1959",birth_year)%>>1959</option>
                          <option value="1958" <%=compare("1958",birth_year)%>>1958</option>
                          <option value="1957" <%=compare("1957",birth_year)%>>1957</option>
                          <option value="1956" <%=compare("1956",birth_year)%>>1956</option>
                          <option value="1955" <%=compare("1955",birth_year)%>>1955</option>
                          <option value="1954" <%=compare("1954",birth_year)%>>1954</option>
                          <option value="1953" <%=compare("1953",birth_year)%>>1953</option>
                          <option value="1952" <%=compare("1952",birth_year)%>>1952</option>
                          <option value="1951" <%=compare("1951",birth_year)%>>1951</option>
                          <option value="1950" <%=compare("1950",birth_year)%>>1950</option>
                          <option value="1949" <%=compare("1949",birth_year)%>>1949</option>
                          <option value="1948" <%=compare("1948",birth_year)%>>1948</option>
                          <option value="1947" <%=compare("1947",birth_year)%>>1947</option>
                          <option value="1946" <%=compare("1946",birth_year)%>>1946</option>
                          <option value="1945" <%=compare("1945",birth_year)%>>1945</option>
                          <option value="1944" <%=compare("1944",birth_year)%>>1944</option>
                          <option value="1943" <%=compare("1943",birth_year)%>>1943</option>
                          <option value="1942" <%=compare("1942",birth_year)%>>1942</option>
                          <option value="1941" <%=compare("1941",birth_year)%>>1941</option>
                          <option value="1940" <%=compare("1940",birth_year)%>>1940</option>
                          <option value="1939" <%=compare("1939",birth_year)%>>1939</option>
                          <option value="1938" <%=compare("1938",birth_year)%>>1938</option>
                          <option value="1937" <%=compare("1937",birth_year)%>>1937</option>
                          <option value="1936" <%=compare("1936",birth_year)%>>1936</option>
                          <option value="1935" <%=compare("1935",birth_year)%>>1935</option>
                          <option value="1934" <%=compare("1934",birth_year)%>>1934</option>
                          <option value="1933" <%=compare("1933",birth_year)%>>1933</option>
                          <option value="1932" <%=compare("1932",birth_year)%>>1932</option>
                          <option value="1931" <%=compare("1931",birth_year)%>>1931</option>
                          <option value="1930" <%=compare("1930",birth_year)%>>1930</option>
                          <option value="1929" <%=compare("1929",birth_year)%>>1929</option>
                          <option value="1928" <%=compare("1928",birth_year)%>>1928</option>
                          <option value="1927" <%=compare("1927",birth_year)%>>1927</option>
                          <option value="1926" <%=compare("1926",birth_year)%>>1926</option>
                          <option value="1925" <%=compare("1925",birth_year)%>>1925</option>
                          <option value="1924" <%=compare("1924",birth_year)%>>1924</option>
                          <option value="1923" <%=compare("1923",birth_year)%>>1923</option>
                          <option value="1922" <%=compare("1922",birth_year)%>>1922</option>
                          <option value="1921" <%=compare("1921",birth_year)%>>1921</option>
                          <option value="1920" <%=compare("1920",birth_year)%>>1920</option>
                          <option value="1919" <%=compare("1919",birth_year)%>>1919</option>
                          <option value="1918" <%=compare("1918",birth_year)%>>1918</option>
                          <option value="1917" <%=compare("1917",birth_year)%>>1917</option>
                          <option value="1916" <%=compare("1916",birth_year)%>>1916</option>
                          <option value="1915" <%=compare("1915",birth_year)%>>1915</option>
                          <option value="1914" <%=compare("1914",birth_year)%>>1914</option>
                          <option value="1913" <%=compare("1913",birth_year)%>>1913</option>
                          <option value="1912" <%=compare("1912",birth_year)%>>1912</option>
                          <option value="1911" <%=compare("1911",birth_year)%>>1911</option>
                          <option value="1910" <%=compare("1910",birth_year)%>>1910</option>
                          <option value="1909" <%=compare("1909",birth_year)%>>1909</option>
                          <option value="1908" <%=compare("1908",birth_year)%>>1908</option>
                          <option value="1907" <%=compare("1907",birth_year)%>>1907</option>
                          <option value="1906" <%=compare("1906",birth_year)%>>1906</option>
                          <option value="1905" <%=compare("1905",birth_year)%>>1905</option>
                          <option value="1904" <%=compare("1904",birth_year)%>>1904</option>
                          <option value="1903" <%=compare("1903",birth_year)%>>1903</option>
                          <option value="1902" <%=compare("1902",birth_year)%>>1902</option>
                          <option value="1901" <%=compare("1901",birth_year)%>>1901</option>
                        </select>
                        年&nbsp;&nbsp;&nbsp;
                        <select name="birth_month" id="birth_month">
                          <option value="-99999">請選擇</option>
                          <option value="1" <%=compare("1",birth_month)%>>1</option>
                          <option value="2" <%=compare("2",birth_month)%>>2</option>
                          <option value="3" <%=compare("3",birth_month)%>>3</option>
                          <option value="4" <%=compare("4",birth_month)%>>4</option>
                          <option value="5" <%=compare("5",birth_month)%>>5</option>
                          <option value="6" <%=compare("6",birth_month)%>>6</option>
                          <option value="7" <%=compare("7",birth_month)%>>7</option>
                          <option value="8" <%=compare("8",birth_month)%>>8</option>
                          <option value="9" <%=compare("9",birth_month)%>>9</option>
                          <option value="10" <%=compare("10",birth_month)%>>10</option>
                          <option value="11" <%=compare("11",birth_month)%>>11</option>
                          <option value="12" <%=compare("11",birth_month)%>>12</option>
                        </select>
                        月 <br/>
                        &nbsp;</td>
                    </tr>
                    <tr>
                      <td>電郵地址:</td>
                      <td><span id="semail">
                        <input name="email" type="text" id="email" size="35" maxlength="35" value="<%=email%>"/>
                        <span class="textfieldRequiredMsg">必須填寫。</span><span class="textfieldInvalidFormatMsg">不正確的電郵地址。</span></span><br/>
                        (登記系統將會發送啟動帳戶電郵到此地址)</td>
                    </tr>
                    <tr>
                      <td>居住地區</td>
                      <td><span id="saddress">
                        <select name="address" id="address">
                          <option value="HKI" <%=compare("HKI",address)%>>香港島</option>
                          <option value="KLN" <%=compare("KLN",address)%>>九龍</option>
                          <option value="NT" <%=compare("NT",address)%>>新界</option>
                          <option value="ISLAND" <%=compare("ISLAND",address)%>>離島</option>
                        </select>
                        <span class="selectRequiredMsg">>請選擇。</span></span></td>
                    </tr>
                    <tr>
                      <td> 電郵通知: </td>
                      <td><input type="checkbox" name="notify" id="notify"  value="YES" checked="checked"/>
                        可以<br/>
                        (你是否想我們發送物品更新通知到你的電郵？)<br/></td>
                    </tr>
                  </table>
                </fieldset>
                <br/>
                <fieldset>
                  <legend>4. 還有一些問題<span class="red-star">*</span></legend>
                  <table width="500" cellpadding="5" class="table-font-12">
                    <tr>
                      <td width="104">驗證碼:<span class="red-star">*</span></td>
                      <td width="368"><span id="scaptcha">
                        <input name="captchacode" type="text" id="captchacode" size="20" maxlength="4" />
                        <span class="textfieldRequiredMsg">必須填寫。</span></span></td>
                    </tr>
                    <tr>
                      <td colspan="2" align="center"><div id="cimageframe"><img src="cimage"/></div>
                        <br/>
                        <a href="javascript:void(0)" onclick="refresh()">看不清文字? 請按此</a></td>
                    </tr>
                  </table>
                </fieldset>
                <table>
                  <tr>
                    <td width="492" align="center"><input type='image' src='images/update-bt.gif'/></td>
                  </tr>
                </table>
              </form>
              <div class="spacer"> &nbsp; </div>
            </div>
          </div>
        </div>
      </div>
      <br/>
      <br/>
      <script type="text/javascript">
<!--
var sprytextfield9 = new Spry.Widget.ValidationTextField("semail", "email", {validateOn:["blur"]});
var spryselect2 = new Spry.Widget.ValidationSelect("saddress", {isRequired:false});
var sprytextfield4 = new Spry.Widget.ValidationTextField("scaptcha", "none");
var CollapsiblePanel2 = new Spry.Widget.CollapsiblePanel("schangepasswordpanel", {contentIsOpen:false});
var sprytextfield7 = new Spry.Widget.ValidationPassword("spassword1", {validateOn:["blur"], minChars:6});
var sprytextfield5 = new Spry.Widget.ValidationPassword("spassword", {validateOn:["blur"], minChars:6});
var sprytextfield6 = new Spry.Widget.ValidationConfirm("srepassword", "spassword", {validateOn:["blur", "change"]});
var sprytextfield4 = new Spry.Widget.ValidationTextField("scaptcha", "none");
//-->
</script>
      <!-- InstanceEndEditable -->
      
    </div>
    <div class="body-rightbar-2column">
      <div class="right-boxbar-2column">
      <!-- InstanceBeginEditable name="rightcolumn" -->
        <div class="title-back">
          <div class="guide-box"></div>
        </div>
        <!-- InstanceEndEditable -->
      </div>
    </div>
    </div>
  <div class="footer">Copyright&copy; <a href="http://www.2handeasy.com" class="footer-link">二手易</a> All rights reserved.  |  版權所有不得轉載</div>
</div>
</body>
<!-- InstanceEnd --></html>
